<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- <div class="container"></div> -->
     <div class="container">
        <div>11</div>
        <div>22</div>
        <div>33</div>
        <div class="delete">44</div>
     </div>
</body>

<script>

    //创建节点
    // let elem=document.createElement('div')
    // elem.id='newdiv'
    // elem.className=" new"
    //console.log(elem)

    //插入节点到DOM树中
    //方式一：插入到指定节点的最后一个孩子之后
    // let container=document.querySelector('.container')
    // container.appendChild(elem)

    //方式二：将节点插入到指定节点之前
    // let elem=document.createElement('div')
    // elem.innerHTML='我是新的节点'

    // let container=document.querySelector('.container')
    // console.log(container.children)
    // container.insertBefore(elem,container.children[0])

    //删除节点
    let parent=document.querySelector(".container")
    let child=document.querySelector(".delete")
    let elem=parent.removeChild(child)
    console.dir(elem)

</script>
</html>